package top.dugou.dugou_sso_server.service.impl;

import org.springframework.stereotype.Service;
import top.dugou.dugou_sso_server.entity.User;
import top.dugou.dugou_sso_server.mapper.UserMapper;
import top.dugou.dugou_sso_server.service.UserService;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public int addUser(User user) {
        return userMapper.insert(user);
    }

    @Override
    public int delUser(Long id) {
        return userMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateByPrimaryKey(user);
    }

    @Override
    public User findById(Long id) {
        return userMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<User> selectByCondition(User user) {
        return userMapper.selectByCondition(user);
    }
}
